package com.mzkj.wanjulaile.mobile.api.modules.session.controller;

import com.mzkj.wanjulaile.mobile.api.common.controller.BaseController;
import com.mzkj.wanjulaile.mobile.api.common.entity.ResultEntity;
import com.mzkj.wanjulaile.mobile.api.modules.session.entity.Session;
import com.mzkj.wanjulaile.mobile.api.modules.session.service.SessionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Session控制类
 * Created by wangxw on 2016/12/14.
 */
@Controller
@RequestMapping("/session")
public class SessionController extends BaseController {

    @Autowired
    private SessionService sessionService;

    @RequestMapping("/refreshToken")
    @ResponseBody
    public ResultEntity<Session> refreshToken(String refreshToken) {
        return sessionService.refreshToken(refreshToken);
    }

    @RequestMapping("/validateToken")
    @ResponseBody
    public ResultEntity<Session> validateToken(String accessToken, String refreshToken) {
        return sessionService.validateToken(accessToken, refreshToken);
    }
}
